<template>
    <div id="myChart" :style="{width: '800px', height: '600px'}"></div>
</template>
<script>

    import axios from 'axios'
    export default {
        name: 'Echarts',
        mounted(){
            let _this=this
            axios.get('http://localhost:8888/wls/wlsType').then(function (response) {
                // 基于准备好的dom，初始化echarts实例
                let myChart = _this.$echarts.init(document.getElementById('myChart'))
                // 绘制图表
                myChart.setOption({
                    title: {
                        text: '卧龙寺用户发布视频类型统计',
                        // subtext: '纯属虚构',
                        left: 'center'
                    },
                    tooltip: {
                        trigger: 'item'
                    },
                    legend: {
                        orient: 'vertical',
                        left: 'left',
                    },
                    series: [
                        {
                            name: '视频类型',
                            type: 'pie',
                            radius: '50%',
                            data: response.data.typeList,
                            // data: [
                            //     {value: 18148, name: 'rose 1'},
                            //     {value: 3341, name: 'rose 2'},
                            //     {value: 3218, name: 'rose 3'},
                            //     {value: 1810, name: 'rose 4'},
                            //     {value: 1527, name: 'rose 5'}
                            // ],
                            emphasis: {
                                itemStyle: {
                                    shadowBlur: 10,
                                    shadowOffsetX: 0,
                                    shadowColor: 'rgba(0, 0, 0, 0.5)'
                                }
                            }
                        }
                    ]
                });
            })

        }
    }
</script>